import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
// 国际化多语言切换
import i18n from '@/i18n'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})

import myComponent from '@/components'
Vue.use(myComponent)

// 自定义指令
import fiximg from '@/directive/fiximg'
Vue.directive('fiximg', fiximg)

// 过滤器全局注册
Vue.filter('formatDate', (oldVal) => {
  return oldVal.split('T')[0]
})
// 批量注册
import * as myFilters from '@/filters'
for (const key in myFilters) {
  // console.log(key)
  const value = myFilters[key]
  Vue.filter(key, value)
}

Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  i18n,
  render: h => h(App)
})
